package com.atguigu.gulimall.order.listener;

import com.atguigu.common.to.mq.SeckillOrderTo;
import com.atguigu.gulimall.order.entity.OrderEntity;
import com.atguigu.gulimall.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @author 马迎迎
 * @Title: OrderSeckillListener
 * @Package com.atguigu.gulimall.order.listener
 * @Description: TODO(添加描述)
 * @date 2021年06月03日 13:19
 */
@Component
@Slf4j
@RabbitListener(queues = "order.seckill.order.queue")
public class OrderSeckillListener {
    @Autowired
    OrderService orderService;
    @RabbitHandler
    public void Listener(SeckillOrderTo to){
        log.info("准备创建秒杀单的订单");
        System.out.println("准备创建秒杀单的订单");

        orderService.createSeckillOrder(to);
    }
}
